using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;

namespace newsApi.Models;
    public class User
    {
        public int Id { get; set; }
        public string FirstName { get; set; }= null!;
        public string LastName { get; set; }= null!;
        public string Username { get; set; }= null!;

        [JsonIgnore]
        public string Password { get; set; }= null!;
        public Role Role { get; internal set; }
}
    public class AuthenticateRequest
    {
        [Required]
        public string Username { get; set; }= null!;

        [Required]
        public string Password { get; set; }= null!;
    }
        public class AuthenticateResponse
    {
        public int Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Username { get; set; }
        public string Token { get; set; }
        public Role Role { get; set; }

        public AuthenticateResponse(User user, string token)
        {
            Id = user.Id;
            FirstName = user.FirstName;
            LastName = user.LastName;
            Username = user.Username;
            Role=user.Role;
            Token = token;
        }
    }
    public enum Role
    {
        Admin,
        User
    }